package DP算法编程_01;

/**
 * User: Mazexal
 * Date: 2021/2/9
 */
public class DpRecursion {
    // 递归调用解决硬币问题 硬币为 2 , 5, 7

    public static void main(String[] args) {
        System.out.println(getMin(27));
    }

    public static int getMin(int input) {
        if (input < 2) {
            return input;
        }
        int res = Integer.MAX_VALUE;
        if (input >= 2) {
            res = Math.min(getMin(input - 2) + 1, res);
        }
        if (input >= 5) {
            res = Math.min(getMin(input - 5) + 1, res);
        }
        if (input >= 7) {
            res = Math.min(getMin(input - 7) + 1, res);
        }
        return res;
    }

}
